<ul class="sf-menu">
{% if not inline %}{# we are in the django admin panel #}
    <li class="current">
        <a href="/" title="&lt;&lt; goto '{{ current_site.domain }}'">
            &lt;&lt; {{ current_site.name }}
        </a>
        {% if not sites|length_is:"1" %}
        <ul>
            {% for site in sites %}
              <li>
                {% ifnotequal site current_site %}
                    <a href="http://{{ site.domain }}/" title="&lt;&lt; goto '{{ site.domain }}'">
                        &lt;&lt; {{ site.name }}
                    </a>
                {% endifnotequal %}
               </li>
            {% endfor %}
        </ul>
        {% endif %}
    </li>
{% endif %}

<li>{% lucidTag auth %}
{% if inline %}{# we are inside a cms page and not in the django admin panel #}
    {% if not sites|length_is:"1" %}
    <ul>
        {% for site in sites %}
          <li>
            {% ifnotequal site current_site %}
                <a href="http://{{ site.domain }}/" title="&lt;&lt; switch to site '{{ site.domain }}'">
                    &lt;&lt; {{ site.name }}
                </a>
            {% endifnotequal %}
           </li>
        {% endfor %}
    </ul>
    {% endif %}
{% endif %}
</li>

{% if inline %}{# is true, if this menu would be included inside the cms page and not in the django admin panel #}
    {% if perms.pylucid.change_pagecontent and perms.pylucid.change_pagemeta %}
    <li>      
        <a href="{{ edit_page_link }}" id="edit_page"
            title="{% trans "edit page content inline" %}"
            onclick="return get_pylucid_ajax_view('{{ edit_page_link }}');">
            {% trans "edit page" %}
        </a>
        <ul>
            {% if perms.pylucid.change_pagetree %}
                <li>
                    <a href="{% url PageAdmin-edit_page PYLUCID.pagetree.id %}"
                        title="{% trans "edit all page attributes in a seperated view" %}">
                        {% trans "edit all" %}
                    </a>
                </li>
            {% endif %}
            {% if PYLUCID.pagecontent %}
                {% if perms.pylucid.change_pagecontent %}
                <li>
                    {# how to use direct the url "pylucid_pagecontent_revision" ? #}
                    <a href="{% url admin:pylucid_pagecontent_change PYLUCID.pagecontent.id %}history/"
                        title="{% trans "See 'PageContent' revision history" %}">
                        {% trans "see content history" %}
                    </a>
                </li>
                {% endif %}
            {% endif %}            
            <li>
                <a title="{% trans "low level editing page parts in django admin panel (not recommented!)" %}">
                    {% trans "django admin" %}
                </a>
                <ul>
                {% if PYLUCID.pluginpage %}
                    {% if perms.pylucid.change_pluginpage %}
                    <li>
                        <a href="{% url admin:pylucid_pluginpage_change PYLUCID.pluginpage.id %}"
                            title="{% trans "edit only 'plugin page' entry in with django admin panel" %}">
                            {% trans "edit plugin page" %}
                        </a>
                    </li>
                    {% endif %}
                {% endif %}
                {% if PYLUCID.pagecontent %}
                    {% if perms.pylucid.change_pagecontent %}
                    <li>
                        <a href="{% url admin:pylucid_pagecontent_change PYLUCID.pagecontent.id %}"
                            title="{% trans "edit only 'PageContent' part in django admin panel" %}">
                            {% trans "edit page content" %}
                        </a>
                    </li>
                    {% endif %}
                {% endif %}
                
                {% if perms.pylucid.change_pagetree %}
                    <li>
                        <a href="{% url admin:pylucid_pagetree_change PYLUCID.pagetree.id %}"
                            title="{% trans "edit only 'PageTree' part in django admin panel" %}">
                            {% trans "edit page tree" %}
                        </a>
                    </li>
                {% endif %}
                {% if perms.pylucid.change_pagemeta %}
                    <li>
                        <a href="{% url admin:pylucid_pagemeta_change PYLUCID.pagemeta.id %}"
                            title="{% trans "edit only 'PageMeta' part in django admin panel" %}">
                            {% trans "edit page meta" %}
                        </a>
                    </li>
                {% endif %}
                </ul>
            </li>
            
            {% if perms.pylucid.change_design %}
            <li>
                <a title="{% trans "edit current style/template in django admin panel" %}" href="{% url admin:pylucid_design_changelist %}">
                    {% trans "edit current look" %}
                </a>
                <ul>
                {% if perms.pylucid.change_design %}
                    <li>
                        <a href="{% url admin:pylucid_design_change PYLUCID.pagetree.design.id %}"
                            title="{% trans "edit current design:" %} '{{ PYLUCID.pagetree.design.name }}'">
                            {% trans "design" %}
                        </a>
                    </li>
                    {% if PYLUCID.pagetree.design.colorscheme %}
                    <li>
                        <a href="{% url admin:pylucid_colorscheme_change PYLUCID.pagetree.design.colorscheme.id %}"
                            title="{% trans "edit current colorscheme:" %} '{{ PYLUCID.pagetree.design.colorscheme.name }}'">
                            {% trans "colorscheme" %}
                        </a>
                    </li>
                    {% endif %}    
                {% endif %}
                {% if perms.pylucid.change_editablehtmlheadfile %}
                    {% for headfile in PYLUCID.pagetree.design.headfiles.all %}
                        <li>
                            <a href="{% url admin:pylucid_editablehtmlheadfile_change headfile.id %}"
                                title="{% trans "edit headfile:" %} '{{ headfile.filepath }}'">
                                {{ headfile.get_filename }}
                            </a>
                        </li>
                    {% endfor %}
                {% endif %}
                {% if perms.dbtemplates.change_template and template %}
                    <li>
                        <a href="{% url admin:dbtemplates_template_change template.id %}"
                            title="{% trans "edit page template:" %} '{{ PYLUCID.pagetree.design.template }}'">
                            {% trans "page template" %}
                        </a>
                    </li>
                {% endif %}
                </ul>
            </li>
            {% endif %}
            
            {% if PYLUCID.pagecontent %}
                {% if add_translate %}
    	            {% if perms.pylucid.add_pagecontent and perms.pylucid.add_pagemeta and perms.pylucid.add_pluginpage %}
    	               <li>
                            <a href="{% url PageAdmin-translate PYLUCID.pagemeta.id %}"
                                title="{% trans "translate page into a other language" %}">
                                {% trans "translate content" %}
                            </a>
                        </li>
    	            {% endif %}
	            {% endif %}

	            {% if perms.pylucid.change_pagecontent %}
                    <li>
                        <a href="{% url PageAdmin-convert_markup PYLUCID.pagecontent.id %}"
                            title="{% trans "Convert page content markup" %}">
                            {% trans "convert markup" %}
                        </a>
                    </li>
	            {% endif %}
            {% endif %}

            {% if perms.pylucid.change_pagetree %}
                <li>
                    <a href="{% url PageAdmin-page_order PYLUCID.pagetree.id %}"
                        title="{% trans "change the link oder of the current menu level" %}">
                        {% trans "change page order" %}
                    </a>
                </li>
            {% endif %}

            {% if perms.pylucid.delete_pageplugin and perms.pylucid.delete_pagecontent and perms.pylucid.delete_pagemeta and perms.pylucid.delete_pagetree %}
                <li>
                    <a href="{% url admin:pylucid_pagetree_delete PYLUCID.pagetree.id %}"
                        title="{% trans "delete current page" %}">
                        {% trans "delete page" %}
                    </a>
                </li>
            {% endif %}
        </ul>
    </li>
    {% endif %}

{% endif %}

{% if user.is_staff %}
<li>
    <a href="{% url admin:index %}"
        title="{% trans "Go into Django Admin site index" %}">
        {% trans "Django admin site" %}
    </a>
    {% if not inline %}{# we are in the django admin panel #}
    {% if not sites|length_is:"1" %}
        <ul>
        {% for site in sites %}
            {% ifnotequal site current_site %}
            <li>
                <a href="http://{{ site.domain }}{{ request.path }}"
                    title="switch to '{{ site.domain }}' admin site.">
                    {{ site.name }}
                </a>
            </li>
            {% endifnotequal %}
        {% endfor %}
        </ul>
    {% endif %}
    {% endif %}
</li>
{% endif %}

<li>
    <a href="{% url PyLucidAdmin-menu %}">
        {% trans "PyLucid admin menu" %}
    </a>
    <ul>
        {% if user.is_superuser %}
        <li>
            <a>PyLucid</a>
            <ul>
                <li>
                    <a href="{% url PyLucidAdmin-install_pylucid %}">{% trans "install PyLucid" %}</a>
                </li>
                <li>
                    <a href="{% url PyLucidAdmin-install_plugins %}">{% trans "install plugins" %}</a>
                </li>
                <li>
                    <a href="{% url PyLucidUpdate-menu %}">{% trans "update section" %}</a>
                </li>
            </ul>
        </li>
        {% endif %}
        {% lucidTag admin_menu.panel_extras %}
    </ul>
</li>
</ul>